const joi = require("joi");

const password = joi.string().pattern(/^[\S]{6,12}$/).required();
const nickname = joi.string().pattern(/^[\S]{1,12}$/).required();
const name = joi.string().pattern(/^[\S]{1,12}$/).required();
const phone = joi.string().pattern(/^1[0-9]+$/).length(11).required();
const address = joi.string().required();
const update_pwd_schema = {
  body: {
    oldPwd: password,
    newPwd: joi.not(joi.ref("oldPwd")).concat(password)
  }
}

const update_nickname_schema = {
  body: {
    nickname
  }
}

const update_addressee_schema = {
  body: {
    name,
    phone,
    address
  }
}

module.exports = {
  update_pwd_schema,
  update_nickname_schema,
  update_addressee_schema,
}